<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="utf-8" />
        <title>tileTemplate tag tests</title>
    </head>
    <body>
        <div id="output"></div>
        <script id="test-tpl" type="text/tileTemplate">
            <%=tag:em:12%>
            <%=tag:em:haha%> <%=tag:em:哈哈%>
            
            <%=tag:time%>
            <%=tag:em:12%>
        </script>
		<script type="text/javascript" src="../src/tiletemplate.js"></script>
        <script>
            console.time('tileTemplate');

            tileTemplate.tag("em", function(content) {
                console.log("回调输出", "em", content);	

                if(content == 12) {
                    return '<img src="http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/0b/tootha_thumb.gif" alt="em'+content+'"/>';
                } else {
                    return content.toString();
                }
            });

            tileTemplate.tag("time", function() {
                return " time: " + (new Date).getTime();
            }); 
            
            tileTemplate.config('debug', true); 

            document.getElementById('output').innerHTML  = tileTemplate.render("test-tpl");
            
            console.timeEnd('tileTemplate');
        </script>
    </body>
</html>